import React, { Component } from 'react';
import './style.scss'
import classnames from 'classnames'
class DemoCLassArr extends Component {
  state = { 
    show:true
   } 
  render() { 
    return (
      <div>
        <h2>动态class</h2>
        动态class-数组方式：
        <div className='classA'>颜色?</div>                                     
        {/* <div className={['classA','classB'].join(' ')}>颜色？</div> */}
        <div className={[this.state.show ? 'classA' : 'classC'].join(' ')}>classnames-动态class</div>
        {/* <div className={[this.state.show ? 'classA' : 'classC classD', 'calssB'].join(' ')}>颜色?</div> */}
        {/* classnames */}
        <div className={classnames('classA','calssB')}>classnames-动态class</div>
        <div className={classnames({show: true})}>classnames-动态class show</div>
        <div className={classnames('a',['a1', 'ab'])}>classnames-动态class</div>
      </div>
    );
  }
}
 
export default DemoCLassArr;